package com.hs.android.fortress.intro;

import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hs.android.fortress.GameApplication;
import com.hs.android.fortress.R;
import com.hs.android.fortress.model.Player;

public class RecordMenuFragement extends Fragment{
	private static final String TAG = "_RecordMenuActivity";
	
	private GameApplication app;
	
	private View fragmentUi;
	
	private TextView txtId, txtWin, txtLose, txtRate;
	
	private Player myInfo;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		app = (GameApplication)getActivity().getApplication();	
		myInfo = app.getPlayer();
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		fragmentUi = inflater.inflate(R.layout.fragment_menu_record, container, false);
		
		txtId = (TextView)fragmentUi.findViewById(R.id.txt_record_id);
		txtWin = (TextView)fragmentUi.findViewById(R.id.txt_record_win);
		txtLose = (TextView)fragmentUi.findViewById(R.id.txt_record_lose);
		txtRate = (TextView)fragmentUi.findViewById(R.id.txt_record_rate);
		
		Log.d(TAG,"onCreateView: myInfo - win/lose = "+ myInfo.getWin()+"/"+myInfo.getLose());
		txtId.setText(myInfo.getId());
		txtWin.setText(""+myInfo.getWin());
		txtLose.setText(""+myInfo.getLose());
		txtRate.setText((int)myInfo.calculateWinRate()+" %");
		return fragmentUi;
	}
	
}
